package cc.co.cutenimy.nimyexplore.jdbc.driver.file;

import java.util.HashMap;
import java.util.Map;

import cc.co.cutenimy.nimyexplore.jdbc.driver.ClassPathLocation;
import cc.co.cutenimy.nimyexplore.jdbc.driver.DriverDescription;
import cc.co.cutenimy.nimyexplore.jdbc.driver.DriverRepository;

public class FileDriverRepository implements DriverRepository {

	private final Map<String, DriverDescription> maps = new HashMap<String, DriverDescription>(
			8);

	public DriverDescription getDriver(String optionTypeName) {
		return maps.get(optionTypeName);
	}

	public void add(String type, String driverClassName,
			ClassPathLocation[] classPathLocations) {
		if (type == null || driverClassName == null) {
			throw new IllegalArgumentException(
					"Type or driver class name should not be empty!");
		}
		maps.put(type, new FileDriverDescription(driverClassName,
				classPathLocations));
	}
}
